<form class="form-horizontal" id="winModal">

    <input id="id" name="id" type="hidden" >
    <div class="form-group">
        <label class="col-sm-3 control-label text-left">分类名称：</label>
        <div class="col-sm-8">
            <input id="name" name="name" class="form-control" type="text" placeholder="请输入事项类型名称">
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-3 control-label text-left">封面图片：</label>
        <div class="col-sm-8">
            <input id="icon" name="icon" class="form-control" type="text" placeholder="请输入事项图标编码">
        </div>
    </div>
    
    
    <div class="form-group">
        <label class="col-sm-3 control-label text-left">事项描述：</label>
        <div class="col-sm-8">
            <input id="description" name="description" class="form-control" type="text" placeholder="请输入事项描述">
        </div>
    </div>
    
     <div class="form-group">
        <label class="col-sm-3 control-label text-left">排序：</label>
        <div class="col-sm-8">
            <input id="sort" name="sort" class="form-control" type="number" placeholder="请输入事项描述">
        </div>
    </div>
</form>
<script type="text/javascript">
    $(function () {
        var e = "<i class='fa fa-times-circle'></i>";
        $("#winModal").validate({
            rules: {
            	title: {
                    required: true,
                    rangelength: [2, 30]
                 },
             	icon: {
                    required: true,
                    rangelength: [2, 30]
                 },
                 description: {
                    required: true,
                    rangelength: [2, 30]
                 },
             	sort: {
                    required: true,
                    number:true
                 }
              
            },
            messages: { //自定义验证消息
                title: {
                    required: e + "请输入事项分类名称",
                    rangelength: $.validator.format(e + "事项分类名称位数要在{0}-{1}个字符之间。")
                },
                icon: {
                    required: e + "请输入图标",
                    rangelength: $.validator.format(e + "图标位数要在{0}-{1}个字符之间。")
                },
                description: {
                    required: e + "请输入详情描述"
                },
                sort: {
                    required: e + "请输入序号"
                }
            }
        });
    });
</script>